<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%> 
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>

<html>
<%
	String basePath = "http://" + request.getLocalAddr() + ":"
			+ request.getLocalPort() + request.getContextPath();
%>
<title>${promptInfo.totalDescInfo}</title>
<head>
<script type="text/javascript">
var ujdata = {
	    globalParam:$("#actionForm").formSerialize(),
	    //type ：first,last
	    //order ：a(升序),d(降序)
    	//serialno:{name:'编号',type:'first',width:'8%',order:'a'},			    
	    //first,last
    	checkbox:{name:'全选',type:'first',width:'10%'},
    	shortcut:{
    		name:'操作',
	    	url:'decorateForwardAction.action',
	    	width:'15%',
	    	event:[
    			{operate:'modify',name:'${pmsIndex.config_database_modify.name}',disabled:'false',isvalid:'${!empty pmsIndex.config_database_modify}',param:'code=${pmsIndex.config_database_modify.code}'},
   				{operate:'del',name:'${pmsIndex.config_database_delete.name}',disabled:'false',isvalid:'${!empty pmsIndex.config_database_delete}',param:'code=${pmsIndex.config_database_delete.code}'}
	        ]
	    },
    	columnDesc:{
	    	//列表要显示的列（在json中对应的key）
			showColumn: ['dbcName','dbcType','dbcIP','dbcPort'],
			//列表头显示名称
			columnName:   ['数据库名称','数据库类型','数据库IP','数据库端口'],
			//列表头宽度
			columnWidth:   ['19%','19%','19%','19%'],
			//可以作为主键的类，在页面传送的过程中为paramMap.orgID=value的形式
			//多个主键的时候为["orgID","orgCode"]:paramMap.orgID=value&paramMap.orgCode=value
			primkeyColumn:["dbcID"],
			//要增加链接的列，可以为多个
			linkColumn:[{name:'',url:'',param:''}]
    	},		
    	ajax:{
        	url:'ajaxAction.action',
        	data:'code=${code}'
	    },
	    //是否有分页工具条
	    isPagination:'true',	    
    	paginationData:{
			pageSize:'10'
    	}		    		 
	};
var ujoption = {
	columnAlias:function(col,val){
		if(col == 'dbcType')
		{
			if (val == '1')
				val = "ORACLE数据库";
			else if (val == '2')
				val =  "SQL Server数据库";
			else if (val == '3')
				val =  "DB2数据库";
			else if (val == '4')
				val =  "INFORMIX数据库";
			else if (val == '5')
				val =  "MY SQL数据库";
		}
		return val;
	}		
};
$(document).ready(function(){	
	$('#grid').gridTB(ujdata,ujoption);	
	$('#delete_database').screenTB({
			windowDocument:window.parent.document,
			width:'250',
			height:'130',
			content:'测试内容',
			contentAlign:'center',
			contentValign:'middle',
			title:'系统提示信息',
			buttonValueYes:'确定',	
			buttonValueNo:'取消',	
			dialogType:'alert',
			iframeSrc:''						
		},{
		clickEvent:function(data){
			if ($("#grid tbody input[type='checkbox']:checked").size() == 0){
				data = $.extend(data,{content:'请选择您要删除的服务器！'})
				return false;
			}
			else{
				var dbcID="",indx = 0;
				$("#grid tbody input[type='checkbox']:checked").each(function(){
					if (indx == 0){
						dbcID=$(this).val();
					}
					else{
						dbcID+=","+$(this).val();
					}
					indx++;
				})
				window.location.href = "decorateForwardAction.action?code=${pmsIndex.config_database_delete.code}&paramMap.dbcID="+dbcID;
				return true;
			}
		}
	});
});

</script>
</head>
<body >
<form name="actionForm" method="post" action="operateAction.action" id="actionForm">
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableC">
  <tr>
   <td class="tableCleft">&nbsp;</td>
   <td class="tableCcenter" align="right">
    	<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" class="SkyTableLine">
         <tr>
           <td class="SkyTDLine" align="right" style="background:#9CC7FF;height:22;" >
	 		<s:if test="pmsIndex.config_database_create">
				<a href="decorateForwardAction.action?code=${pmsIndex.config_database_create.code}"><img src="<%=request.getContextPath()%>/${pmsIndex.config_database_create.icon}" align="absmiddle" width="14" border="0" height="14">${pmsIndex.config_database_create.name}</a>
	  		</s:if>
			<s:if test="pmsIndex.config_database_delete">
				<a id="delete_database" href="#"><img src="<%=request.getContextPath()%>/${pmsIndex.config_database_delete.icon}" align="absmiddle" width="14" border="0" height="14">${pmsIndex.config_database_delete.name}</a>
			</s:if>
	     </td>
           </tr>
         </table>   
      </td>
     <td class="tableCright">&nbsp;</td>
   </tr>
	<tr>
		<td class="tableCleft">&nbsp;</td>
		<td class="tableCcenter" id="grid" valign="top"></td>
		<td class="tableCright">&nbsp;</td>
	</tr>
</table>
</form> 
</body>
</HTML>
